/**
 *
 * Vertical Histogram of words in a Sentence
 *
 **/

#include<stdio.h>

#define MAXWL 20  /* Maximum length of a word */
#define MAXNO 25 /* Maximum No of words in a sentence */

int main(void)
{
    int word[MAXNO];
    // 循环控制，读取的字符，第二层循环控制，字符数量，第几个单词
    int    i,     c,          j,        nc,      nw;

    // 初始化数组，每一项是单词包含的字符数
    for (i = 0;i < MAXNO; ++i)
        word[i] = 0;

    nc = nw = 0;

    while( (c=getchar()) != 97)
    {
        ++nc;
        if( c ==' ' || c =='\n' || c =='\t')
        {
            /* -1 for excluding the space in the word length */
            word[nw] = nc -1;

            ++nw;
            /* resetting the word-length for the next word */
            nc = 0;
        }
    }

    for( i = MAXWL; i >= 1; --i)
    {
        for(j=0;j <= nw;++j)
        {
            if( i <= word[j])
                putchar('*');
            else
                putchar(' ');
        }
        putchar('\n');
    }

    return 0;
}